﻿using System;
using System.Collections.Generic;
using LinFu.Proxy.Interfaces;
using Mono.Cecil;

namespace CoreEx.Common.Proxy
{
    /// <summary>
    /// Represents a class that is capable of modifying a <see cref="IProxy"/> type during construction.
    /// </summary>
    public interface ITypeModifier
    {
        /// <summary>
        /// Executes just before the proxy type has been constructed.
        /// </summary>
        /// <param name="originalBaseType">The base class from which the proxy is inherited.</param>
        /// <param name="baseInterfaces">The list of interfaces implemented by the proxy type.</param>
        /// <param name="module">The <see cref="ModuleDefinition"/> that will hold the brand new type.</param>        
        /// <param name="typeDefinition">The <see cref="TypeDefinition"/> that represents the created type.</param>
        void BeforeConstruction(Type originalBaseType, IEnumerable<Type> baseInterfaces,
                                          ModuleDefinition module, TypeDefinition typeDefinition);
        
        /// <summary>
        /// Executes just after the proxy type has been constructed.
        /// </summary>
        /// <param name="originalBaseType">The base class from which the proxy is inherited.</param>
        /// <param name="baseInterfaces">The list of interfaces implemented by the proxy type.</param>
        /// <param name="module">The <see cref="ModuleDefinition"/> that will hold the brand new type.</param>
        /// <param name="typeDefinition">The <see cref="TypeDefinition"/> that represents the created type.</param>
        void AfterConstruction(Type originalBaseType, IEnumerable<Type> baseInterfaces,
                                          ModuleDefinition module, TypeDefinition typeDefinition);     
    }    
}